import axios from 'axios'
import qs from 'qs'
/*
    自定义一个post请求
*/
export const postRequest = (url, params) => {
  return axios({
    method: 'post',
    url: `${url}`,
    data: params,

    transformRequest: [function (data) {
      data = qs.stringify(data)
      /* let ret = ''
      for (let it in data) {
        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
      }
      return ret */
      return data
    }],
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
